<template>
    <ul class="item-list">
      <router-link class="item" tag="li" v-for="item in list" :key="item.id" :to="'/detail/'+item.id">
        <img class="item-img" v-lazy="item.imgUrl" alt="">
        <div class="item-info">
          <div class="item-title">{{item.title}}</div>
          <div class="item-desc">{{item.desc}}</div>
          <button class="item-button">查看详情</button>
        </div>
      </router-link>
    </ul>
</template>

<script scoped>
export default {
  name: 'List',
  props: {
    list: {
      type: Array,
      default () {
        return []
      }
    }
  },
  data () {
    return {
    }
  },
  components: {}
}
</script>

<style lang='less' scoped>
  .item-list{
    padding:.2rem;
    .flex();
    flex-wrap: wrap;
    .item{
     width: 3.48rem;
     margin-right: 0.14rem;
     margin-bottom: 0.1rem;
     &:nth-child(even){
       margin-right: 0;
     }
      .item-img{
        border-radius: 5%;
        width: 100%;
        height: 2rem;
      }
      .item-info{
        text-align: center;
        .item-title{
          line-height: .54rem;
          font-size: .32rem;
          .ellipsis();
        }
        .item-desc{
          line-height: .4rem;
          color: #ccc;
          .ellipsis();
        }
        .item-button{
          line-height: .44rem;
          margin-top: .16rem;
          background: #ff9300;
          padding: 0 .2rem;
          border-radius: .06rem;
          color: #fff;
        }
      }
    }
  }
</style>
